home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / pdftops / xpdf / h / Array next >
Text File  |  1996-06-08  |  1KB  |  54 lines

  1. //========================================================================
  2. //
  3. // Array.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef ARRAY_H
  10. #define ARRAY_H
  11.  
  12. #ifdef __GNUC__
  13. //#pragma interface
  14. #endif
  15.  
  16. #include "Object.h"
  17.  
  18. //------------------------------------------------------------------------
  19. // Array
  20. //------------------------------------------------------------------------
  21.  
  22. class Array {
  23. public:
  24.  
  25.   // Constructor.
  26.   Array();
  27.  
  28.   // Destructor.
  29.   ~Array();
  30.  
  31.   // Reference counting.
  32.   int incRef() { return ++ref; }
  33.   int decRef() { return --ref; }
  34.  
  35.   // Get number of elements.
  36.   int getLength() { return length; }
  37.  
  38.   // Add an element.
  39.   void add(Object *elem);
  40.  
  41.   // Accessors.
  42.   Object *get(int i, Object *obj);
  43.   Object *getNF(int i, Object *obj);
  44.  
  45. private:
  46.  
  47.   Object *elems;        // array of elements
  48.   int size;            // size of <elems> array
  49.   int length;            // number of elements in array
  50.   int ref;            // reference count
  51. };
  52.  
  53. #endif
  54.